﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DocumentEdit.aspx.cs" Inherits="InformationSystem.WebSite.Module.DocumentMgr.DocumentEdit" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript">
        function callback() {
            parent.ResizeFrameHeight(GridPanel1.getHeight());
            //parent.ResizeFrameHeight(ViewPort1.getHeight(500));
        }
    </script>
    <style type="text/css">
        .x-grid3-cell-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid-group-hd div
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid3-hd-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
            font-size: 12px;
        }
        
        .x-grid3-body .x-grid3-td-Cost
        {
            background-color: #f1f2f4;
        }
        
        .x-grid3-summary-row .x-grid3-td-Cost
        {
            background-color: #e1e2e4;
        }
        
        .total-field
        {
            background-color: #fff;
            font-weight: bold !important;
            color: #000;
            border: solid 1px silver;
            padding: 2px;
            margin-right: 5px;
        }
    </style>
    <script type="text/javascript">
        var removeDocument = function () {
            var grid = GridPanel1;
            grid.deleteSelected();
            SharedDocumentStore.save();
        }
        function callback() {
            parent.ResizeFrameHeight(GridPanel1.getHeight());
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager runat="server">
        <Listeners>
            <DocumentReady Fn="callback()" />
        </Listeners>
    </ext:ResourceManager>
    <ext:GridPanel ID="GridPanel1" runat="server" Frame="true" StripeRows="true" Title="共享文件"
        AutoExpandColumn="fileid"  AnimCollapse="false" Icon="ApplicationViewColumns"
        TrackMouseOver="false" Width="650" Height="450">
        <Store>
            <ext:Store ID="SharedDocumentStore" runat="server" AutoLoad="true" OnBeforeRecordDeleted="BeforeRecordDeleted"
                OnAfterStoreChanged="AfterStoreChanged">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="fileid" Mapping="FileID" Type="Int" />
                            <ext:RecordField Name="uploadfilename" Mapping="UploadFileName" Type="String" />
                            <ext:RecordField Name="savefilename" Mapping="SaveFileName" Type="String" />
                            <ext:RecordField Name="createuserid" Mapping="CreateUserID" Type="String" />
                            <ext:RecordField Name="createusername" Mapping="CreateUserName" Type="String" />
                            <ext:RecordField Name="collegeid" Mapping="CollegeId" Type="Int" />
                            <ext:RecordField Name="gradeid" Mapping="GradeId" Type="Int" />
                            <ext:RecordField Name="ispublictocollege" Mapping="IsPublicToCollege" Type="Boolean" />
                            <ext:RecordField Name="createtime" Mapping="CreateTime" Type="Date" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        
        <ColumnModel runat="server">
            <Columns>
                <ext:Column ColumnID="fileid" Header="序号" Width="30" DataIndex="fileid" Hidden="true" />
                <ext:Column ColumnID="uploadfilename" Header="文件名称" DataIndex="uploadfilename" Width="450">
                    <Commands>
                        <ext:ImageCommand CommandName="Download" Icon="DiskDownload">
                            <ToolTip Text="下载" />
                        </ext:ImageCommand>
                    </Commands>
                </ext:Column>
                <ext:DateColumn ColumnID="createtime" Header="上传时间" DataIndex="createtime" Width="110" Format="yyyy-MM-dd HH:mm">
                </ext:DateColumn>
            </Columns>
        </ColumnModel>
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Button ID="btnDelete" runat="server" Text="删除" Icon="Delete" ToolTip="删除选中的文件">
                        <Listeners>
                            <Click Fn="removeDocument" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btnRefresh" runat="server" Text="刷新" Icon="ArrowRefresh" ToolTip="刷新共享文件列表">
                        <DirectEvents>
                            <Click OnEvent="btnRefresh_Click">
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel" runat="server">
            </ext:CheckboxSelectionModel>
        </SelectionModel>
        <DirectEvents>
            <Command OnEvent="btnDownload_Click" IsUpload="true">
                <ExtraParams>
                    <ext:Parameter Name="hdnfileid" Value="record.data.fileid" Mode="Raw">
                    </ext:Parameter>
                </ExtraParams>
            </Command>
        </DirectEvents>
    </ext:GridPanel>
    </form>
</body>
</html>
